import requests
import time
import pdb
import json

# pdb.set_trace()
baseUrl = u"http://127.0.0.1:8000/api/report/"
testUrl = u"https://violin.kyshh.com/api/user/"


def submitReport():
    data = {
        'token': '52a779c9222edd75c990',
        'reportTime': '2020-02-02',
        'reportType': '思想汇报',
        'html': '<h1>旧的报告</h1>',
        'devPeo': '曾有成-2018010905',
        'reportId': '2',
    }
    # pdb.set_trace()
    response = requests.post(baseUrl + 'submitreport/', data=data)
    print(response.content.decode('utf-8'))


def getReportList():
    data = {
        'token': '52a779c9222edd75c990',
    }
    # pdb.set_trace()
    response = requests.post(baseUrl + 'getreportlist/', data=data)
    print(response.content.decode('utf-8'))


def deleteRp():
    data = {
        'token': '0a7de5c509cda7d26a89',
        'reportId': '11'
    }
    # pdb.set_trace()
    response = requests.post(baseUrl + 'delete/', data=data)
    print(response.content.decode('utf-8'))


def getReportContent():
    data = {
        'token': '0a7de5c509cda7d26a89',
        'reportId': '8'
    }
    # pdb.set_trace()
    response = requests.post(baseUrl + 'getcontent/', data=data)
    print(response.content.decode('utf-8'))


def getCheckList():
    data = {
        'token': 'c33d144d64558d6d6c63',
    }
    # pdb.set_trace()
    response = requests.post(baseUrl + 'getckeck/', data=data)
    print(response.content.decode('utf-8'))


def submitCheck():
    data = {
        'token': '5291313cd9ffeb610eb0',
        'comment': '测试一下白钦对汪霄的评价',
        'correctHtml': '<p><span style="background-color: rgb(245, 219, 77);">这是正式党员修改之后的文本</span></p>',
        'reportId':'4',
        'isDone': True,
    }
    # pdb.set_trace()
    response = requests.post(baseUrl + 'submitcheck/', data=data)
    print(response.content.decode('utf-8'))

def test(num):
    data = {
    }
    response = requests.get(u'https://www.bjyouth.gov.cn/html/1//232/'+str(num)+'.html', data=data)
    print(u'https://www.bjyouth.gov.cn/html/1//232/'+str(num)+'.html')
    print(response.content.decode('utf-8'))


if __name__ == '__main__':
    # submitReport()
    # test()
    # getReportList()
    # deleteRp()
    # getReportContent()
    # getCheckList()
    # submitCheck()
    num = 4842
    for i in range(200):
        num += 1
        test(num)
        time.sleep(0.5)
        

